package com.ma.model;

import lombok.Data;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Max;
import java.util.List;
import java.util.Map;

@Data
@ConfigurationProperties(prefix = "person")

//如果其他地方需要使用Person类则需要把它注入到组件中
@Component

//批量注入可以使用数据校验
@Validated
public class Person {
    @Email(message = "格式必须为邮箱")
    private String name;

    @Max(value = 100,message = "年龄必须小于100")
    private Integer age;

    private Boolean isBoss;

    private List<String> friendsList;
    private Map<String,Object> map;
    private Dog dog;
}
